<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>导调功能测试</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background: #f0f0f0;
        }
        .test-container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .test-section {
            margin-bottom: 30px;
            padding: 15px;
            border: 1px solid #ddd;
            border-radius: 5px;
        }
        .test-title {
            color: #2196F3;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 10px;
        }
        .test-description {
            color: #666;
            margin-bottom: 15px;
        }
        .test-button {
            background: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            margin-right: 10px;
            margin-bottom: 10px;
        }
        .test-button:hover {
            background: #45a049;
        }
        .test-button.danger {
            background: #f44336;
        }
        .test-button.danger:hover {
            background: #d32f2f;
        }
        .status {
            margin-top: 10px;
            padding: 10px;
            border-radius: 4px;
            font-weight: bold;
        }
        .status.success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .status.error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .status.info {
            background: #d1ecf1;
            color: #0c5460;
            border: 1px solid #bee5eb;
        }
        .feature-list {
            list-style-type: none;
            padding: 0;
        }
        .feature-list li {
            padding: 8px 0;
            border-bottom: 1px solid #eee;
        }
        .feature-list li:before {
            content: "✓ ";
            color: #4CAF50;
            font-weight: bold;
        }
        .feature-list li.completed {
            color: #4CAF50;
        }
        .feature-list li.pending {
            color: #ff9800;
        }
        .feature-list li.pending:before {
            content: "⏳ ";
            color: #ff9800;
        }
    </style>
</head>
<body>
    <div class="test-container">
        <h1>🚁 Cesium Demo 导调功能测试</h1>
        
        <div class="test-section">
            <div class="test-title">✅ 已完成功能</div>
            <div class="test-description">以下功能已成功添加到 test-vue-cesium-h3-ws-v1.html 文件中：</div>
            <ul class="feature-list">
                <li class="completed">下拉菜单样式 (CSS)</li>
                <li class="completed">GeoJSON记录表格扩展 (添加名称和方案ID列)</li>
                <li class="completed">导调按钮 (局部避障)</li>
                <li class="completed">sendLocalAvoidance 方法实现</li>
                <li class="completed">WebSocket消息发送功能</li>
                <li class="completed">错误处理和用户提示</li>
            </ul>
        </div>

        <div class="test-section">
            <div class="test-title">🧪 功能测试</div>
            <div class="test-description">请按以下步骤测试导调功能：</div>
            <ol>
                <li>打开 <code>test-vue-cesium-h3-ws-v1.html</code> 文件</li>
                <li>连接WebSocket服务器</li>
                <li>绘制一个多边形区域</li>
                <li>在GeoJSON记录表格中查看新增的"名称"和"方案ID"列</li>
                <li>点击"导调"按钮，选择"局部避障"</li>
                <li>检查WebSocket消息是否正确发送</li>
            </ol>
        </div>

        <div class="test-section">
            <div class="test-title">🔧 技术实现</div>
            <div class="test-description">导调功能的技术实现细节：</div>
            <ul class="feature-list">
                <li>使用Vue.js响应式数据绑定</li>
                <li>CSS下拉菜单样式 (hover触发)</li>
                <li>GeoJSON坐标提取和验证</li>
                <li>WebSocket消息格式：wsClientType: "2"</li>
                <li>错误处理和用户友好的提示信息</li>
            </ul>
        </div>

        <div class="test-section">
            <div class="test-title">📋 使用方法</div>
            <div class="test-description">导调功能的使用方法：</div>
            <div class="status info">
                <strong>步骤1：</strong> 在地图上绘制多边形区域<br>
                <strong>步骤2：</strong> 在GeoJSON记录表格中编辑名称和方案ID<br>
                <strong>步骤3：</strong> 点击"导调"按钮，选择"局部避障"<br>
                <strong>步骤4：</strong> 系统将发送WebSocket消息到服务器
            </div>
        </div>

        <div class="test-section">
            <div class="test-title">🚀 启动测试</div>
            <div class="test-description">点击下面的按钮启动测试：</div>
            <button class="test-button" onclick="openTestFile()">打开测试文件</button>
            <button class="test-button" onclick="showWebSocketInfo()">WebSocket信息</button>
            <button class="test-button danger" onclick="clearTestData()">清除测试数据</button>
            <div id="status" class="status" style="display: none;"></div>
        </div>
    </div>

    <script>
        function openTestFile() {
            window.open('test-vue-cesium-h3-ws-v1.html', '_blank');
            showStatus('已打开测试文件，请在新窗口中测试导调功能', 'success');
        }

        function showWebSocketInfo() {
            const info = `
WebSocket连接信息：
- 默认地址：ws://127.0.0.1:6088/uam/v2/ws/uam/channel/245
- 局部避障消息格式：
  {
    "wsClientType": "2",
    "planId": 1,
    "polygon": {
      "type": "Feature",
      "properties": {
        "name": "绘制多边形",
        "timestamp": "2024-01-01T12:00:00.000Z"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [[[lng1,lat1], [lng2,lat2], ...]]
      }
    }
  }
            `;
            alert(info);
        }

        function clearTestData() {
            if (confirm('确定要清除所有测试数据吗？')) {
                localStorage.clear();
                showStatus('已清除所有测试数据', 'info');
            }
        }

        function showStatus(message, type) {
            const statusDiv = document.getElementById('status');
            statusDiv.textContent = message;
            statusDiv.className = `status ${type}`;
            statusDiv.style.display = 'block';
            
            setTimeout(() => {
                statusDiv.style.display = 'none';
            }, 5000);
        }

        // 页面加载完成后的初始化
        document.addEventListener('DOMContentLoaded', function() {
            showStatus('导调功能测试页面已加载完成', 'success');
        });
    </script>
</body>
</html>
